package others;

import lombok.Data;

import java.util.Objects;

/**
 * @author ycz
 * @date 2021/5/31
 * @description TODO
 *
 */
@Data
public class EqualTest {

    private String name;

    public EqualTest(String name) {
        this.name = name;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        EqualTest equalTest = (EqualTest) o;
        return Objects.equals(name, equalTest.name);
    }

    @Override
    public int hashCode() {
        return 17;
    }

    public static void main(String[] args) {
        EqualTest equalTest = new EqualTest("1");
        EqualTest equalTest1 = new EqualTest("2");
        EqualTest equalTest2 = new EqualTest("2");
        System.out.println(equalTest.hashCode());
        System.out.println(equalTest1.hashCode());
        System.out.println(equalTest2.hashCode());
        System.out.println("=============");
        System.out.println(equalTest == equalTest1);
        System.out.println(equalTest.equals(equalTest1));
        System.out.println("=============");
        System.out.println(equalTest1 == equalTest2);
        System.out.println(equalTest1.equals(equalTest2));

        System.out.println(Runtime.getRuntime().availableProcessors());
    }


}
